import type {ButtonType, Column} from "element-plus";
import {IDatePickerType} from "element-plus/es/components/date-picker/src/date-picker.type";
export interface IObj {
  [key: string]: any;
}

//重写类型
type Override<T, U> = {
  [k in keyof T]: k extends keyof U ? U[k] : T[k]
}
//交叉和映射
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
type IElColumnType = "button"
//width 变为可选类型
export type IElColumn<T> = Optional<Column<T>, "width"> & {
  child?: IElColumn<T>[]
  dict?: string
  show?: boolean
  sot?: boolean
  type?: IElColumnType
  click?: (row:any) => void
  format?:<K>(row:K) => K
}
export type IButton = {
  label: string
  click: void
  type: ButtonType
}
export type IHeader ={
  span: number
  label: string
  plain: boolean
  vHasPermi: string[]
  buttonType: ButtonType
  type: string
  click: void
  icon: string
  show:boolean
  disable: boolean
}

export interface ITree{
  label: string
  children?: ITree[]
}

export type IElDatePicker = {
  type?: IDatePickerType,
  format?: any,
  valueFormat?: any
  placeholder?: string,
}

export type IFormOptions = {
  dataKey: string
  width: string
  title: string
  clearable: boolean
  slot: boolean
  placeholder: string
  datePicker: IElDatePicker
}

export type IELPagination = IObj & {
  pageSizes?: number[]
  pagerCount?: any,
  background?: boolean,
  total?: number,
  layout?: string
}